package core;

import java.util.ArrayList;
import java.util.List;

public class FakeSelectionTree extends VectorialSelectionTree {
	
	private List<Object2D> mObjects;
	
	public FakeSelectionTree(List<Object2D> objs) {
		super(0, 0, 0);
		mObjects = objs;
	}
	
	public List<Node> getIntersectionNodes(Point3D pt, double margenErro) {
		List<Node> selectedNodes = new ArrayList<Node>();
		
		for(Object2D o : mObjects) {
			
			VectorialObject vo = (VectorialObject) o;
			
			if(!(o instanceof VectorialObject)) {
				continue;
			}
			
			for(int i = 0; i < vo.getVerticeCount(); i++) {
				Point3D curpoint = vo.getVertice(i);
				if(pt.getX() >= curpoint.getX() - margenErro && pt.getX() <= curpoint.getX() + margenErro &&
						pt.getY() >= curpoint.getY() - margenErro && pt.getY() <= curpoint.getY() + margenErro){
					Node n = new Node();
					n.point = curpoint;
					n.object = vo;
					selectedNodes.add(n);
				}
			}
		}
		return selectedNodes;
	}

	@Override
	public void addVertices(VectorialObject obj) {
	}

	@Override
	public Region getRegion() {
		return null;
	}

	@Override
	public int getRegionsMatrixOrder() {
		return 0;
	}

	@Override
	public void removeVertices(VectorialObject obj) {
	}

	@Override
	public void setRegionsDepth(int regionsDepth) {
	}

	@Override
	public void setRegionsMatrixOrder(int regionsMatrixOrder) {
	}

	@Override
	public void updateNode(Node node) {
	}
}
